package com.example.acceletracks;

import java.io.Serializable;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.google.android.gms.maps.model.LatLng;

public class AcceleHoles implements Serializable {

	private static final long serialVersionUID = 1L;
	private final Set<LatLng> points;
	
	public AcceleHoles() {
        this.points = new HashSet<LatLng>();
	}
	
	public AcceleHoles(Set<LatLng> points) {
		this.points = new HashSet<LatLng>(points);
	}
	
	public AcceleHoles(List<LatLng> points) {
		this.points = new HashSet<LatLng>(points);
	}
	
	public void addPoint(final LatLng p)
	{
		this.points.add(p);

	}

	public void addPoints(final List<LatLng> points) {
		this.points.addAll(points);

	}

	public int getLength() {
		return points.size();
	}
	public Set<LatLng> getPoints() {
		return points;
	}
	
	
	@Override
	public String toString() {
		
		StringBuffer buffer = new StringBuffer();
		
		for(int i=0; i<points.size(); i++)
		{
			LatLng latlng=(LatLng)points.toArray()[i];
			buffer.append(latlng.latitude + ",");
			buffer.append(latlng.longitude + "\n");
		}
		return buffer.toString();
	}
	
	
	public LatLng[] toArray() {
		LatLng[] array = points.toArray(new LatLng[points.size()]);
		
		return array;
	}

	
}
